<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('房源审核列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>名称：</label>
                            <input type="text" name="name"/>
                        </li>
                        <!--<li>-->
                        <!--<label>装修：</label>-->
                        <!--<select name="renovationId" class="form-control m-b" >-->
                        <!--<option value="">所有</option>-->
                        <!--<option th:each="dict : ${renovationList}" th:text="${dict.name}" th:value="${dict.id}"></option>-->
                        <!--</select>-->
                        <!--</li>-->
                        <!--<li>-->
                        <!--<label>类型：</label>-->
                        <!--<select name="typeId" class="form-control m-b" >-->
                        <!--<option value="">所有</option>-->
                        <!--<option th:each="dict : ${typeList}" th:text="${dict.name}" th:value="${dict.id}"></option>-->
                        <!--</select>-->
                        <!--</li>-->
                        <li>
                            <label>状态：</label>
                            <select name="stat" class="form-control m-b">
                                <option value="0,2">所有</option>
                                <option value="0">待审核</option>
                                <option value="2">不通过</option>
                            </select>
                        </li>
                        <li>
                            <label>独家房源：</label>
                            <select name="sole" class="form-control m-b"  th:with="type=${@dict.getType('house_sole')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>类型：</label>
                            <select name="type" class="form-control m-b" th:with="type=${@dict.getType('house_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system/house:house:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system/house:house:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system/house:house:remove">
                <i class="fa fa-remove"></i> 删除
            </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system/house:house:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system/house:house:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system/house:house:remove')}]];
    var statusDatas = [[${@dict.getType('house_status')}]];
    var soleDatas = [[${@dict.getType('house_sole')}]];
    var typeDatas = [[${@dict.getType('house_type')}]];
    var prefix = ctx + "system/house/house";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/exmine/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "房源信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'memberName',
                    title: '推荐人姓名',
                    formatter: function (value,row,index) {
                        if(value==null){
                            return "系统添加";
                        }
                        return value;
                    }
                },
                {
                    field: 'name',
                    title: '名称'
                },
                // {
                //     field: 'renovation',
                //     title: '装修'
                // },
                // {
                //     field: 'type',
                //     title: '类型'
                // },
                // {
                //     field: 'orientation',
                //     title: '朝向'
                // },
                // {
                //     field: 'years',
                //     title: '年代'
                // },
                // {
                //     field: 'address',
                //     title: '地址'
                // },
                {
                    field: 'price',
                    title: '售价(单位：万)'
                },
                {
                    field: 'priceOne',
                    title: '单价(单位：元)'
                },
                {
                    field: 'houseRoom',
                    title: '户型',
                    formatter: function(value, row, index) {
                        return row.houseRoom+"室-"+row.houseLivingRoom+"厅-"+row.houseToilet+"卫";
                    }
                },
                {
                    field: 'area',
                    title: '面积'
                },
                {
                    field: 'floor',
                    title: '楼层',
                    formatter: function(value, row, index) {
                        return row.floor+"/"+row.floorMax;
                    }
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'sole',
                    title: '独家房源',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(soleDatas, value);
                    }
                },
                {
                    field: 'type',
                    title: '类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(typeDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>处理</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>